<!-- Transaction Information -->
<div class="row">
    <div class="col-xs-12">
        <div class="panel panel-default table-responsive">
            <div class="panel-heading panel-heading-lg">
                <i class="fa fa-lg fa-trash"></i> Destroy Details
                <a href="#" class="btn btn-xs btn-success pull-right" id="history-info-more" target="_blank"><i class="fa fa-info-circle"></i> more info</a>
            </div>
            <table class="table table-striped table-bordered table-condensed">
            <tbody>
            <tr>
                <td class="info bold" width="130">Transaction Hash</td>
                <td id="tx-hash"></td>
            </tr>
            <tr>
                <td class="info bold">Block #</td>
                <td id="block"></td>
            </tr>
            <tr>
                <td class="info bold">Time</td>
                <td id="timestamp"></td>
            </tr>
            <tr>
                <td class="info bold">Source</td>
                <td id="source"></td>
            </tr>
            <tr>
                <td class="info bold">Asset</td>
                <td id="asset"></td>
            </tr>
            <tr>
                <td class="info bold">Quantity</td>
                <td id="quantity">-</td>
            </tr>
            <tr>
                <td class="info bold">Tag / Memo</td>
                <td id="tag"></td>
            </tr>
            <tr>
                <td class="info bold">Status</td>
                <td id="status"></td>
            </tr>
            </tbody>
            </table>
        </div>
    </div>
</div><!-- end row -->

<!-- Code to load/update data -->
<script type="text/javascript">
    var tx = FW.CURRENT_TRANSACTION.tx;

    $(document).ready(function(){

        // Update 'more info' link to point to transaction url
        $('#history-info-more').attr('href', FW.EXPLORER_API + '/tx/' + tx);

        // Request transaction information
        $.getJSON(FW.EXPLORER_API + '/api/tx/' + tx, function( o ){
            if(!o.error){
                var asset = (o.asset_longname && o.asset_longname!='') ? o.asset_longname : o.asset,
                    fmt   = (String(o.quantity).indexOf('.')==-1) ? '0,0' : '0,0.00000000';
                $('#source').html(o.source);
                $('#timestamp').html('<span data-livestamp='  + o.timestamp + ' class="nowrap"></span> (' + moment.unix(o.timestamp).utcOffset(0).format() + ' GMT)');
                $('#block').html(numeral(o.block_index).format('0,0'));
                $('#tx-hash').text(o.tx_hash);
                $('#tx-index').text(numeral(o.tx_index).format('0,0'));
                $('#asset').html('<img src="' + FW.EXPLORER_API + '/icon/' + o.asset + '.png" class="asset-icon-sm pull-left">' + asset);
                $('#quantity').text(numeral(o.quantity).format(fmt));
                $('#status').text(o.status);
                $('#tag').text(hex2string(o.tag));
            }
        });

    });

</script>
